require 'test/unit'
require './group-of-methods_exercise2'

class X < Test::Unit::TestCase
    def test_x
        assert_equal('expected', 'expected')
    end

    def test_y
        puts "Hi, I am being tested."
    end

    def test_month_before
        assert_equal(Time.local(2014, 06, 23), month_before(Time.local(2014, 07, 21)))
    end

    def test_header
        assert_equal("Changes since 2014-06-23:", header(Time.local(2014, 06, 23)))
        assert_equal("Changes since 2014-06-23:", header(month_before(Time.local(2014, 07, 21))))
    end

    def test_normal_subsystem_line_format
        assert_equal("         audit ********* (45)", subsystem_line("audit", 45))
        assert_equal("            ui - (0)", subsystem_line("ui",0))
        assert_equal("            ui * (1)",subsystem_line("ui",1))
        assert_equal("            ui * (2)",subsystem_line("ui",2))
    end

    def test_stars
        assert_equal("*****", stars(25))
    end

    def test_stars_round_down_up
        assert_equal("****", stars(21))
        assert_equal("****", stars(18))
    end

    def test_subversion_log_has_no_changes
        assert_equal(0, extract_number_of_changes("-------------------------------\n"))
    end

    def test_subversion_log_has_changes
        assert_equal(2, extract_number_of_changes("-------------------------\
------------------------------=----------\nr2531 | bem | 2005-07-01 01:1\
1:44 -0500 (Fri, 01 Jul 2005) | 1 line\n\nrevisions up through ch 3 exer\
cises\n---------------------------------=-------------------------------\
-\nr2524 | bem | 2005-06-30 18:45:59 -0500 (Thu, 30 Jun 2005) | 1 line\n\
\nresults of read-through; including renaming mistyping to snapshots\n--\
-------------------------------------------\n"))
    end

    def test_get_count_from_line
	assert_equal(4, get_count_from_line("audit *(4)"))
    end 

    def test_subsystem_lines
#	assert_equal("            ui - (0)", subsystem_line("ui",0))
	assert_equal("          util *** (13)", subsystem_line("util",13))
	assert_equal("            ui * (1)",subsystem_line("ui",1))
	assert_equal("            ui * (2)",subsystem_line("ui",2))
    end
end
